﻿<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WetHatLab.OneNote.TaggingKit.manage"
        xmlns:cui="clr-namespace:WetHatLab.OneNote.TaggingKit.common.ui"
        mc:Ignorable="d"
        d:DataContext="{d:DesignInstance IsDesignTimeCreatable=True, Type={x:Type local:TagManagerDesignerModel}}"
        xmlns:prop="clr-namespace:WetHatLab.OneNote.TaggingKit.Properties"
        x:Class="WetHatLab.OneNote.TaggingKit.manage.TagManager"
        WindowStartupLocation="CenterOwner"
        MinWidth="350"
        MinHeight="250"
        WindowStyle="ToolWindow"
        Title="{Binding Mode=OneTime, Source={x:Static prop:Resources.TagManager_Window_Title}}"
        Height="{Binding Source={x:Static prop:Settings.Default},Path=TagManagerWindow_Height,Mode=TwoWay}"
        Width="{Binding Source={x:Static prop:Settings.Default},Path=TagManagerWindow_Width,Mode=TwoWay}" Closing="Window_Closing" Icon="/OneNoteTaggingKit;component/Resources/settings 32x32.png" Loaded="Window_Loaded">
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/OneNoteTaggingKit;component/Resources/Styles.xaml"/>
                <ResourceDictionary>
                    <ContextMenu x:Key="contextMenu">
                        <MenuItem Header="{Binding Mode=OneTime, Source={x:Static prop:Resources.TagManager_ContextMenu_Copy}}" Click="Copy_MenuItem_Click">
                            <MenuItem.Icon>
                                <Image Source="/OneNoteTaggingKit;component/Resources/copy-26.png" />
                            </MenuItem.Icon>
                        </MenuItem>
                    </ContextMenu>
                </ResourceDictionary>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>

    <Window.Background>
        <LinearGradientBrush EndPoint="0.5,1" MappingMode="RelativeToBoundingBox" StartPoint="0.5,0">
            <GradientStop Color="Ivory" Offset="0.497"/>
            <GradientStop Color="#FFF3DEF2" Offset="1"/>
        </LinearGradientBrush>
    </Window.Background>
    <TabControl Grid.Row="0"  Background="Transparent">
        <TabItem Header="{Binding Mode=OneTime, Source={x:Static prop:Resources.TagManager_TagSuggestionsTab_Header}}"
                    IsSelected="True"
                    BorderThickness="0"
                    ToolTip="{Binding Mode=OneTime, Source={x:Static prop:Resources.TagManager_TagSuggestionsTab_Tooltip}}">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="*" />
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <local:RemovableTagsPanel Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2"
                                              ContextMenu="{StaticResource contextMenu}"
                                              BorderThickness="1" BorderBrush="{DynamicResource {x:Static SystemColors.ControlLightBrushKey}}"
                                              Tags="{Binding SuggestedTags}"
                                              Margin="5,5,5,0" />
                <ProgressBar Name="pBar" Visibility="Visible"
                                 Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2"/>
                <cui:TagInputBox x:Name="tagInput" Grid.Row="2" Grid.Column="0"
                                 ToolTip="{Binding Mode=OneTime, Source={x:Static prop:Resources.TagManager_NewTagTextbox_Tooltip}}"
                                 Margin="5,5,10,5"
                                 VerticalAlignment="Center"
                                 TagInput="TagInputBox_Input" />
                <StackPanel Orientation="Horizontal"
                                Grid.Row="2" Grid.Column="2">
                    <Button x:Name="newTagButton"
                            Style="{StaticResource controlEffectStyle}"
                            Width="26" Height="26"
                            ToolTip="{Binding Mode=OneTime, Source={x:Static prop:Resources.TagManager_NewTagButton_Tooltip}}"
                            Click="NewTagButton_Click"
                            Margin="0,0,5,0">
                        <Button.Background>
                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                <GradientStop Color="#FF00FF00" Offset="0"/>
                                <GradientStop Color="#FFB0ADAD" Offset="1"/>
                            </LinearGradientBrush>
                        </Button.Background>
                        <TextBlock FontFamily="Segoe UI Symbol" Text="✙"
                                   FontSize="22"
                                   FontWeight="ExtraBold"
                                   TextAlignment="Center"  VerticalAlignment="Center"
                                   />
                    </Button>
                    <Button Style="{DynamicResource controlEffectStyle}" Width="26" Height="26"
                            ToolTip="{Binding Mode=OneTime, Source={x:Static prop:Resources.TagManager_SaveTagsButton_Tooltip}}"
                            Click="SaveButton_Click">
                        <Image Source="/OneNoteTaggingKit;component/Resources/save-26.png" />
                    </Button>
                </StackPanel>
            </Grid>
        </TabItem>
        <TabItem Header="{Binding Mode=OneTime, Source={x:Static prop:Resources.TagManager_AboutTab_Header}}">
            <RichTextBox IsReadOnly="True" IsDocumentEnabled="True"  Background="Transparent" Margin="5,5,5,0" BorderThickness="0" >
                <FlowDocument >
                    <Paragraph >
                        <Image Source="/OneNoteTaggingKit;component/Resources/tag 32x32.png" Height="32" HorizontalAlignment="Left" VerticalAlignment="Top"/>
                        <Run BaselineAlignment="Center" Text="{Binding Mode=OneTime, Source={x:Static prop:Resources.TaggingKit_About_Appname}}" FontWeight="Bold" FontSize="16" Foreground="LightSeaGreen"/>
                        <Run BaselineAlignment="Center" Text="{Binding AddinVersion, Mode=OneTime}"/>
                    </Paragraph>
                    <Paragraph>
                        <Run Text ="{Binding Mode=OneTime, Source={x:Static prop:Resources.TaggingKit_About_Description}}" FontWeight="Bold"/>
                    </Paragraph>
                    <Paragraph>
                        <Run Text ="{Binding Mode=OneTime, Source={x:Static prop:Resources.TaggingKit_About_Copyright}}"/>
                    </Paragraph>
                    <Paragraph>
                        <Run Text ="{Binding Mode=OneTime, Source={x:Static prop:Resources.TaggingKit_About_Framework}}"/>
                        <Run BaselineAlignment="Center" Text="{Binding FrameworkVersion, Mode=OneTime}"/>
                    </Paragraph>
                    <Paragraph>
                        <Run Text ="{Binding Mode=OneTime, Source={x:Static prop:Resources.TaggingKit_About_Website}}"/>
                        <Hyperlink NavigateUri="{Binding Mode=OneTime, Source={x:Static prop:Resources.TaggingKit_About_AddIn_Website}}" RequestNavigate="Hyperlink_RequestNavigate">
                            <Run Text ="{Binding Mode=OneTime, Source={x:Static prop:Resources.TaggingKit_About_AddIn_Website}}"/>
                        </Hyperlink>
                    </Paragraph>
                    <Paragraph>
                        <Run Text ="{Binding Mode=OneTime, Source={x:Static prop:Resources.TaggingKit_About_Logfile}}"/>
                        <Hyperlink NavigateUri="{Binding Logfile}" RequestNavigate="Hyperlink_RequestLogNavigate">
                            <Run Text ="{Binding Logfile, Mode=OneTime}"/>
                        </Hyperlink>
                    </Paragraph>
                </FlowDocument>
            </RichTextBox>
        </TabItem>
    </TabControl>
</Window>
